
from restaurant import Restaurant

print("\n##########################9.1#########################")
class Dog:
    def __init__(self,name='super dog',age = 9999):
        self.name = name
        self.age = age

    def sit(self):
        print(self.name.title() + ' who is ' + str(self.age) + ' years old is now sitting.')

    def roll_over(self):
        print(self.name.title() + ' who is ' + str(self.age) + ' years old is now rolling over.')


dog1 = Dog('little dog',999)
dog2 = Dog('middle dog')
dog3 = Dog()
dog1.roll_over()
dog2.roll_over()
dog3.roll_over()

print('my dog`s name is %s' % dog1.name.title())
print('my dog`s age is %s' % dog1.age)

print("\n##########################prac-9.1#########################")

res = Restaurant('辣椒炒肉','湘菜')
res.describe_restaurant()
res.open_restaurant()


print("\n##########################9.2#########################")

class Car():
    def __init__(self,make,model,year):
        self.make = make
        self.model = model
        self.year = year
        self.odometer = 0

    def get_descriptive_name(self):
        long_name = str(self.year) + ' ' + self.make + ' ' + self.model
        return long_name

    def read_odometer(self):
        print('the car has %s miles on it' % self.odometer)

    def update_odometer(self,miles):
        if miles >= self.odometer:
            self.odometer = miles
        else:
            print('You can`t roll back an odometer')

    def increase_odometer(self,miles):
        self.odometer += miles


mycar = Car('Audi','A4',2019)
print(mycar.get_descriptive_name())

mycar.odometer = 23
mycar.read_odometer()

mycar.update_odometer(55)
mycar.read_odometer()

mycar.update_odometer(44)
mycar.read_odometer()

mycar.increase_odometer(11)
mycar.read_odometer()

print("\n##########################prac-9.2#########################")

res = Restaurant('super meet','hehe')
res.number_served = 11
res.read_number_served()
res.set_number_served(22)
res.read_number_served()
res.increase_number_served(33)
res.read_number_served()


print("\n##########################9.3#########################")

print("\n##########################prac-9.5#########################")

